fix(socket): re-raise CancelledError instead of silently swallowing#2921
Open
hobostay wants to merge 1 commit into
Open
fix(socket): re-raise CancelledError instead of silently swallowing#2921hobostay wants to merge 1 commit into
hobostay wants to merge 1 commit into
Conversation
Several SocketIO event handlers caught `asyncio.CancelledError` and passed without re-raising. This masks cancellation signals and causes the task to appear as completed rather than cancelled, which can lead to incorrect state in callers that check `task.cancelled()`. The `finally` blocks still execute on re-raise, so cleanup (e.g. `task_end()`) remains unaffected. Affected handlers: process_message, edit_message, window_message, audio_end. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-raise CancelledError instead of silently catching and passing in four SocketIO event handlers. This ensures tasks are properly marked as cancelled while still allowing finally blocks to execute for cleanup.
Summary by cubic
Re-raise asyncio.CancelledError in SocketIO event handlers so cancellation propagates and tasks are correctly marked as cancelled. Cleanup in finally blocks is unaffected.
process_message,edit_message,window_message,audio_end.task.cancelled()now get accurate state.Written for commit f1c49cc. Summary will update on new commits.